package com.snda.sc.auth;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;

public class JsonResult extends AbstractAuthResult {

	@Override
	public void doRender(HttpServletRequest request, HttpServletResponse response) throws IOException {
		response.setContentType("application/json;charset=UTF-8");

		PrintWriter out = response.getWriter();
		Map<String, Object> props = mergeProp();
		if (isTestEnv()) props.put("testEnv", true);
		out.write(JSON.toJSONString(props));
		out.flush();
	}
}
